From f77ef48c1d5a5f2709bc375e9e121a0b160bad3b Mon Sep 17 00:00:00 2001 From: "awilliam@xenbuild.aw" Date: Tue, 5 Dec 2006 09:09:44 -0700 Subject: [PATCH] [IA64][LIBXC] prep for fixes Groundwork for real fixes to follow Signed-off-by: Alex Williamson --- tools/libxc/ia64/xc_ia64_hvm_build.c | 27 ++++----------------------- tools/libxc/xc_linux_build.c | 3 +++ 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/tools/libxc/ia64/xc_ia64_hvm_build.c b/tools/libxc/ia64/xc_ia64_hvm_build.c index c12dfc3d84..325442b1b4 100644 --- a/tools/libxc/ia64/xc_ia64_hvm_build.c +++ b/tools/libxc/ia64/xc_ia64_hvm_build.c @@ -581,8 +581,7 @@ add_pal_hob(void* hob_buf) */ static int setup_guest(int xc_handle, uint32_t dom, unsigned long memsize, - char *image, unsigned long image_size, uint32_t vcpus, - unsigned int store_evtchn, unsigned long *store_mfn) + char *image, unsigned long image_size, vcpu_guest_context_t *ctxt) { xen_pfn_t *pfn_list; shared_iopage_t *sp; @@ -669,11 +668,6 @@ setup_guest(int xc_handle, uint32_t dom, unsigned long memsize, if (xc_domctl(xc_handle, &domctl)) goto error_out; - if (xc_domain_translate_gpfn_list(xc_handle, dom, nr_pages, - pfn_list, pfn_list)) { - PERROR("Could not translate addresses of HVM guest.\n"); - goto error_out; - } // Load guest firmware if (xc_ia64_copy_to_domain_pages(xc_handle, dom, image, @@ -692,10 +686,8 @@ setup_guest(int xc_handle, uint32_t dom, unsigned long memsize, xc_set_hvm_param(xc_handle, dom, HVM_PARAM_STORE_PFN, STORE_PAGE_START>>PAGE_SHIFT); - xc_set_hvm_param(xc_handle, dom, HVM_PARAM_STORE_EVTCHN, store_evtchn); // Retrieve special pages like io, xenstore, etc. - *store_mfn = pfn_list[nr_pages - 2]; sp = (shared_iopage_t *)xc_map_foreign_range(xc_handle, dom, PAGE_SIZE, PROT_READ | PROT_WRITE, pfn_list[nr_pages - 3]); @@ -717,12 +709,9 @@ error_out: } int -xc_hvm_build(int xc_handle, uint32_t domid, int memsize, - const char *image_name, unsigned int vcpus, unsigned int pae, - unsigned int acpi, unsigned int store_evtchn, - unsigned long *store_mfn) +xc_hvm_build(int xc_handle, uint32_t domid, int memsize, const char *image_name) { - struct xen_domctl launch_domctl, domctl; + struct xen_domctl launch_domctl; int rc; vcpu_guest_context_t st_ctxt, *ctxt = &st_ctxt; char *image = NULL; @@ -748,18 +737,10 @@ xc_hvm_build(int xc_handle, uint32_t domid, int memsize, return 1; } - domctl.cmd = XEN_DOMCTL_getdomaininfo; - domctl.domain = (domid_t)domid; - if (do_domctl(xc_handle, &domctl) < 0 || - (uint16_t)domctl.domain != domid) { - PERROR("Could not get info on domain"); - goto error_out; - } - memset(ctxt, 0, sizeof(*ctxt)); if (setup_guest(xc_handle, domid, (unsigned long)memsize, image, - image_size, vcpus, store_evtchn, store_mfn) < 0) { + image_size, ctxt) < 0) { ERROR("Error constructing guest OS"); goto error_out; } diff --git a/tools/libxc/xc_linux_build.c b/tools/libxc/xc_linux_build.c index 9bd4a5e3f4..e3f68b6f00 100644 --- a/tools/libxc/xc_linux_build.c +++ b/tools/libxc/xc_linux_build.c @@ -565,6 +565,9 @@ static int setup_guest(int xc_handle, start_info = xc_map_foreign_range( xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE, page_array[nr_pages - 3]); + if ( start_info == NULL ) + goto error_out; + memset(start_info, 0, sizeof(*start_info)); rc = xc_version(xc_handle, XENVER_version, NULL); sprintf(start_info->magic, "xen-%i.%i-ia64", rc >> 16, rc & (0xFFFF)); -- 2.30.2